From 77d8f863729f3b2d0eded2be5a230174ed4baff9 Mon Sep 17 00:00:00 2001 From: Matthew Daley Date: Wed, 30 Oct 2013 20:51:56 +1300 Subject: [PATCH] xl: check for restore file open failure in create_domain ...otherwise you get a less helpful error message. Coverity-ID: 1055569 Signed-off-by: Matthew Daley Reviewed-by: Andrew Cooper Acked-by: Ian Campbell --- tools/libxl/xl_cmdimpl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 43d15190e2..a935a18cb4 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1919,6 +1919,10 @@ static uint32_t create_domain(struct domain_create *dom_info) } else { restore_source = restore_file; restore_fd = open(restore_file, O_RDONLY); + if (restore_fd == -1) { + fprintf(stderr, "Can't open restore file: %s\n", strerror(errno)); + return ERROR_INVAL; + } rc = libxl_fd_set_cloexec(ctx, restore_fd, 1); if (rc) return rc; } -- 2.30.2